export class HtmlSubscription {
  static events = {};

  static subscribe(eventType, callback) {
    if (!HtmlSubscription.events[eventType]) {
      HtmlSubscription.events[eventType] = [];
    }
    HtmlSubscription.events[eventType].push(callback);
  };

  static publish(eventType, data) {
    const callbacks = HtmlSubscription.events[eventType];
    if (callbacks) {
      callbacks.forEach(callback => callback(data));
    }
  };

  static unsubscribe(eventType, callback) {
    if (HtmlSubscription.events[eventType]) {
      HtmlSubscription.events[eventType] = HtmlSubscription.events[eventType].filter(cb => cb !== callback);
    }
  };
  
};